package org.springframework.listener;

import org.springframework.context.ApplicationListener;
import org.springframework.event.MyselfEvent;
import org.springframework.stereotype.Component;

/**
 * 自定义监听
 */
@Component
public class MyselfListener implements ApplicationListener<MyselfEvent> {

    @Override
    public void onApplicationEvent(MyselfEvent event) {
        // 处理事件
        event.event();
		System.out.println("监听接受事件");
        System.out.println("Received event with message: " + event.getMessage());
    }
}